<template>
    <div>
        <p>用户<input type="text" v-model="username"></p>
        <p>密码<input type="password" v-model="password"></p>
        <p>电话<input type="phone" v-model="phone"></p>
        <p><input type="button" value="注册" @click="reg()"></p>
    </div>
</template>

<script>
import axios from "axios"
export default {
    name:"jwt_reg",
    data(){
        return{
            username:"",
            password:"",
            phone:""
        }
    },
    methods:{
        reg:function(){
            axios({
                url:"api/users/v1/register/",
                method:"post",
                data:{
                    username:this.username,
                    password:this.password,
                    phone:this.phone
                }
            }).then(res=>{
                console.log(res)
                sessionStorage.setItem("jwt_token",res.data.token)
                this.$router.push({path:"jwtshow"})
            })
        }
    }
}
</script>

<style>

</style>
